package com.dwms.feign.system;

import com.dwms.entity.PageResponse;
import com.dwms.entity.QueryRequest;
import com.dwms.entity.Result;
import com.dwms.entity.system.user.request.ModifyPassword;
import com.dwms.entity.system.user.request.UserQueryRequest;
import com.dwms.entity.system.user.request.UserRequest;
import com.dwms.entity.system.user.response.UserResponse;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

/**
 * @ClassName UserApi
 * @Description: 用户API
 * @Create 2022/10/19 19:37
 * @Author WH
 * @Since 1.0.0
 */
@FeignClient(value = "system-server",path = "/user")
public interface UserFeignClient {

    /**
     * 新增
     *
     * @param userRequest
     *          请求参数
     */
    @PostMapping("/save")
    Result save(@RequestBody UserRequest userRequest);

    /**
     * 修改
     *
     * @param userRequest
     *          请求参数
     */
    @PostMapping("/update")
    Result update(@RequestBody UserRequest userRequest);

    /**
     * 分页查询
     * @return UserResponse
     */
    @PostMapping("/findPage")
    Result<PageResponse<UserResponse>> findPage(@RequestBody UserQueryRequest query);

    /**
     * 根据ID查询
     */
    @PostMapping("/findById")
    Result findById(@RequestBody QueryRequest query);

    /**
     * 删除
     * @return UserInfo
     */
    @PostMapping("/delete")
    Result delete(@RequestBody QueryRequest query);


    /**
     * 启用/禁用
     * @param query
     * @return
     */
    @PostMapping("/enabled")
    Result enabled(@RequestBody QueryRequest query);

    /**
     * 锁定/解锁
     * @param query
     * @return
     */
    @PostMapping("/locked")
    Result locked(@RequestBody QueryRequest query);

    /**
     * 修改密码
     * @param modifyPassword
     * @return
     */
    @PostMapping("/modifyPassword")
    Result modifyPassword(@RequestBody ModifyPassword modifyPassword);
}
